<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A> 
</CENTER>






<HR>

<H3>fix command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID group-ID style args 
</PRE>
<UL><LI>ID = user-assigned name for the fix
<LI>group-ID = ID of the group of atoms to apply the fix to
<LI>style = one of a long list of possible style names (see below)
<LI>args = arguments used by a particular style 
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 all nve
fix 3 all nvt temp 300.0 300.0 0.01
fix mine top setforce 0.0 NULL 0.0 
</PRE>
<P><B>Description:</B>
</P>
<P>Set a fix that will be applied to a group of atoms.  In LAMMPS, a
"fix" is any operation that is applied to the system during
timestepping or minimization.  Examples include updating of atom
positions and velocities due to time integration, controlling
temperature, applying constraint forces to atoms, enforcing boundary
conditions, computing diagnostics, etc.  There are dozens of fixes
defined in LAMMPS and new ones can be added; see <A HREF = "Section_modify.html">this
section</A> for a discussion.
</P>
<P>Fixes perform their operations at different stages of the timestep.
If 2 or more fixes operate at the same stage of the timestep, they are
invoked in the order they were specified in the input script.
</P>
<P>The ID of a fix can only contain alphanumeric characters and
underscores.
</P>
<P>Fixes can be deleted with the <A HREF = "unfix.html">unfix</A> command.
</P>
<P>IMPORTANT NOTE: The <A HREF = "unfix.html">unfix</A> command is the only way to turn
off a fix; simply specifying a new fix with a similar style will not
turn off the first one.  This is especially important to realize for
integration fixes.  For example, using a <A HREF = "fix_nve.html">fix nve</A>
command for a second run after using a <A HREF = "fix_nh.html">fix nvt</A> command
for the first run, will not cancel out the NVT time integration
invoked by the "fix nvt" command.  Thus two time integrators would be
in place!
</P>
<P>If you specify a new fix with the same ID and style as an existing
fix, the old fix is deleted and the new one is created (presumably
with new settings).  This is the same as if an "unfix" command were
first performed on the old fix, except that the new fix is kept in the
same order relative to the existing fixes as the old one originally
was.  Note that this operation also wipes out any additional changes
made to the old fix via the <A HREF = "fix_modify.html">fix_modify</A> command.
</P>
<P>The <A HREF = "fix_modify.html">fix modify</A> command allows settings for some
fixes to be reset.  See the doc page for individual fixes for details.
</P>
<P>Some fixes store an internal "state" which is written to binary
restart files via the <A HREF = "restart.html">restart</A> or
<A HREF = "write_restart.html">write_restart</A> commands.  This allows the fix to
continue on with its calculations in a restarted simulation.  See the
<A HREF = "read_restart.html">read_restart</A> command for info on how to re-specify
a fix in an input script that reads a restart file.  See the doc pages
for individual fixes for info on which ones can be restarted.
</P>
<HR>

<P>Some fixes calculate one of three styles of quantities: global,
per-atom, or local, which can be used by other commands or output as
described below.  A global quantity is one or more system-wide values,
e.g. the energy of a wall interacting with particles.  A per-atom
quantity is one or more values per atom, e.g. the displacement vector
for each atom since time 0.  Per-atom values are set to 0.0 for atoms
not in the specified fix group.  Local quantities are calculated by
each processor based on the atoms it owns, but there may be zero or
more per atoms.
</P>
<P>Note that a single fix may produces either global or per-atom or local
quantities (or none at all), but never more than one of these.
</P>
<P>Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values.  The
doc page for each fix describes the style and kind of values it
produces, e.g. a per-atom vector.  Some fixes produce more than one
kind of a single style, e.g. a global scalar and a global vector.
</P>
<P>When a fix quantity is accessed, as in many of the output commands
discussed below, it can be referenced via the following bracket
notation, where ID is the ID of the fix:
</P>
<DIV ALIGN=center><TABLE  BORDER=1 >
<TR><TD >f_ID </TD><TD > entire scalar, vector, or array</TD></TR>
<TR><TD >f_ID[I] </TD><TD > one element of vector, one column of array</TD></TR>
<TR><TD >f_ID[I][J] </TD><TD > one element of array 
</TD></TR></TABLE></DIV>

<P>In other words, using one bracket reduces the dimension of the
quantity once (vector -> scalar, array -> vector).  Using two brackets
reduces the dimension twice (array -> scalar).  Thus a command that
uses scalar fix values as input can also process elements of a vector
or array.
</P>
<P>Note that commands and <A HREF = "variable.html">variables</A> which use fix
quantities typically do not allow for all kinds, e.g. a command may
require a vector of values, not a scalar.  This means there is no
ambiguity about referring to a fix quantity as f_ID even if it
produces, for example, both a scalar and vector.  The doc pages for
various commands explain the details.
</P>
<HR>

<P>In LAMMPS, the values generated by a fix can be used in several ways:
</P>
<UL><LI>Global values can be output via the <A HREF = "thermo_style.html">thermo_style
custom</A> or <A HREF = "fix_ave_time.html">fix ave/time</A> command.
Or the values can be referenced in a <A HREF = "variable.html">variable equal</A> or
<A HREF = "variable.html">variable atom</A> command. 

<LI>Per-atom values can be output via the <A HREF = "dump.html">dump custom</A> command
or the <A HREF = "fix_ave_spatial.html">fix ave/spatial</A> command.  Or they can be
time-averaged via the <A HREF = "fix_ave_atom.html">fix ave/atom</A> command or
reduced by the <A HREF = "compute_reduce.html">compute reduce</A> command.  Or the
per-atom values can be referenced in an <A HREF = "variable.html">atom-style
variable</A>. 

<LI>Local values can be reduced by the <A HREF = "compute_reduce.html">compute
reduce</A> command, or histogrammed by the <A HREF = "fix_ave_histo.html">fix
ave/histo</A> command. 
</UL>
<P>See this <A HREF = "Section_howto.html#howto_15">howto section</A> for a summary of
various LAMMPS output options, many of which involve fixes.
</P>
<P>The results of fixes that calculate global quantities can be either
"intensive" or "extensive" values.  Intensive means the value is
independent of the number of atoms in the simulation,
e.g. temperature.  Extensive means the value scales with the number of
atoms in the simulation, e.g. total rotational kinetic energy.
<A HREF = "thermo_style.html">Thermodynamic output</A> will normalize extensive
values by the number of atoms in the system, depending on the
"thermo_modify norm" setting.  It will not normalize intensive values.
If a fix value is accessed in another way, e.g. by a
<A HREF = "variable.html">variable</A>, you may want to know whether it is an
intensive or extensive value.  See the doc page for individual fixes
for further info.
</P>
<HR>

<P>Each fix style has its own documentation page which describes its
arguments and what it does, as listed below.  Here is an alphabetic
list of fix styles available in LAMMPS:
</P>
<UL><LI><A HREF = "fix_adapt.html">adapt</A> - change a simulation parameter over time
<LI><A HREF = "fix_addforce.html">addforce</A> - add a force to each atom
<LI><A HREF = "fix_append_atoms.html">append/atoms</A> - append atoms to a running simulation
<LI><A HREF = "fix_aveforce.html">aveforce</A> - add an averaged force to each atom
<LI><A HREF = "fix_ave_atom.html">ave/atom</A> - compute per-atom time-averaged quantities
<LI><A HREF = "fix_ave_histo.html">ave/histo</A> - compute/output time-averaged histograms
<LI><A HREF = "fix_ave_spatial.html">ave/spatial</A> - compute/output time-averaged per-atom quantities by layer
<LI><A HREF = "fix_ave_time.html">ave/time</A> - compute/output global time-averaged quantities
<LI><A HREF = "fix_bond_break.html">bond/break</A> - break bonds on the fly
<LI><A HREF = "fix_bond_create.html">bond/create</A> - create bonds on the fly
<LI><A HREF = "fix_bond_swap.html">bond/swap</A> - Monte Carlo bond swapping
<LI><A HREF = "fix_box_relax.html">box/relax</A> - relax box size during energy minimization
<LI><A HREF = "fix_deform.html">deform</A> - change the simulation box size/shape
<LI><A HREF = "fix_deposit.html">deposit</A> - add new atoms above a surface
<LI><A HREF = "fix_drag.html">drag</A> - drag atoms towards a defined coordinate
<LI><A HREF = "fix_dt_reset.html">dt/reset</A> - reset the timestep based on velocity, forces
<LI><A HREF = "fix_efield.html">efield</A> - impose electric field on system
<LI><A HREF = "fix_enforce2d.html">enforce2d</A> - zero out z-dimension velocity and force
<LI><A HREF = "fix_evaporate.html">evaporate</A> - remove atoms from simulation periodically
<LI><A HREF = "fix_external.html">external</A> - callback to an external driver program
<LI><A HREF = "fix_freeze.html">freeze</A> - freeze atoms in a granular simulation
<LI><A HREF = "fix_gravity.html">gravity</A> - add gravity to atoms in a granular simulation
<LI><A HREF = "fix_gcmc.html">gcmc</A> - grand canonical insertions/deletions
<LI><A HREF = "fix_heat.html">heat</A> - add/subtract momentum-conserving heat
<LI><A HREF = "fix_indent.html">indent</A> - impose force due to an indenter
<LI><A HREF = "fix_langevin.html">langevin</A> - Langevin temperature control
<LI><A HREF = "fix_lineforce.html">lineforce</A> - constrain atoms to move in a line
<LI><A HREF = "fix_momentum.html">momentum</A> - zero the linear and/or angular momentum of a group of atoms
<LI><A HREF = "fix_move.html">move</A> - move atoms in a prescribed fashion
<LI><A HREF = "fix_msst.html">msst</A> - multi-scale shock technique (MSST) integration
<LI><A HREF = "fix_neb.html">neb</A> - nudged elastic band (NEB) spring forces
<LI><A HREF = "fix_nh.html">nph</A> - constant NPH time integration via Nose/Hoover
<LI><A HREF = "fix_nph_asphere.html">nph/asphere</A> - NPH for aspherical particles
<LI><A HREF = "fix_nph_sphere.html">nph/sphere</A> - NPH for spherical particles
<LI><A HREF = "fix_nphug.html">nphug</A> - constant-stress Hugoniostat integration
<LI><A HREF = "fix_nh.html">npt</A> - constant NPT time integration via Nose/Hoover
<LI><A HREF = "fix_npt_asphere.html">npt/asphere</A> - NPT for aspherical particles
<LI><A HREF = "fix_npt_sphere.html">npt/sphere</A> - NPT for spherical particles
<LI><A HREF = "fix_nve.html">nve</A> - constant NVE time integration
<LI><A HREF = "fix_nve_asphere.html">nve/asphere</A> - NVE for aspherical particles
<LI><A HREF = "fix_nve_asphere_noforce.html">nve/asphere/noforce</A> - NVE for aspherical particles without forces"
<LI><A HREF = "fix_nve_body.html">nve/body</A> - NVE for body particles
<LI><A HREF = "fix_nve_limit.html">nve/limit</A> - NVE with limited step length
<LI><A HREF = "fix_nve_line.html">nve/line</A> - NVE for line segments
<LI><A HREF = "fix_nve_noforce.html">nve/noforce</A> - NVE without forces (v only)
<LI><A HREF = "fix_nve_sphere.html">nve/sphere</A> - NVE for spherical particles
<LI><A HREF = "fix_nve_tri.html">nve/tri</A> - NVE for triangles
<LI><A HREF = "fix_nh.html">nvt</A> - constant NVT time integration via Nose/Hoover
<LI><A HREF = "fix_nvt_asphere.html">nvt/asphere</A> - NVT for aspherical particles
<LI><A HREF = "fix_nvt_sllod.html">nvt/sllod</A> - NVT for NEMD with SLLOD equations
<LI><A HREF = "fix_nvt_sphere.html">nvt/sphere</A> - NVT for spherical particles
<LI><A HREF = "fix_orient_fcc.html">orient/fcc</A> - add grain boundary migration force
<LI><A HREF = "fix_planeforce.html">planeforce</A> - constrain atoms to move in a plane
<LI><A HREF = "fix_poems.html">poems</A> - constrain clusters of atoms to move   as coupled rigid bodies
<LI><A HREF = "fix_pour.html">pour</A> - pour new atoms into a granular simulation domain
<LI><A HREF = "fix_press_berendsen.html">press/berendsen</A> - pressure control by      Berendsen barostat
<LI><A HREF = "fix_print.html">print</A> - print text and variables during a simulation
<LI><A HREF = "fix_reax_bonds.html">reax/bonds</A> - write out ReaxFF bond information <A HREF = "fix_recenter.html">recenter</A> - constrain the center-of-mass position   of a group of atoms
<LI><A HREF = "fix_restrain.html">restrain</A> - constrain a bond, angle, dihedral
<LI><A HREF = "fix_rigid.html">rigid</A> - constrain one or more clusters of atoms to      move as a rigid body with NVE integration
<LI><A HREF = "fix_rigid.html">rigid/nph</A> - constrain one or more clusters of atoms to      move as a rigid body with NPH integration
<LI><A HREF = "fix_rigid.html">rigid/npt</A> - constrain one or more clusters of atoms to      move as a rigid body with NPT integration
<LI><A HREF = "fix_rigid.html">rigid/nve</A> - constrain one or more clusters of atoms to      move as a rigid body with alternate NVE integration
<LI><A HREF = "fix_rigid.html">rigid/nvt</A> - constrain one or more clusters of atoms to      move as a rigid body with NVT integration
<LI><A HREF = "fix_setforce.html">setforce</A> - set the force on each atom
<LI><A HREF = "fix_shake.html">shake</A> - SHAKE constraints on bonds and/or angles
<LI><A HREF = "fix_spring.html">spring</A> - apply harmonic spring force to group of atoms
<LI><A HREF = "fix_spring_rg.html">spring/rg</A> - spring on radius of gyration of      group of atoms
<LI><A HREF = "fix_spring_self.html">spring/self</A> - spring from each atom to its origin
<LI><A HREF = "fix_srd.html">srd</A> - stochastic rotation dynamics (SRD)
<LI><A HREF = "fix_store_force.html">store/force</A> - store force on each atom
<LI><A HREF = "fix_store_state.html">store/state</A> - store attributes for each atom
<LI><A HREF = "fix_temp_berendsen.html">temp/berendsen</A> - temperature control by      Berendsen thermostat
<LI><A HREF = "fix_temp_rescale.html">temp/rescale</A> - temperature control by      velocity rescaling
<LI><A HREF = "fix_thermal_conductivity.html">thermal/conductivity</A> - Muller-Plathe kinetic energy exchange for      thermal conductivity calculation
<LI><A HREF = "fix_tmd.html">tmd</A> - guide a group of atoms to a new configuration
<LI><A HREF = "fix_ttm.html">ttm</A> - two-temperature model for electronic/atomic coupling
<LI><A HREF = "fix_viscosity.html">viscosity</A> - Muller-Plathe momentum exchange for      viscosity calculation
<LI><A HREF = "fix_viscous.html">viscous</A> - viscous damping for granular simulations
<LI><A HREF = "fix_wall.html">wall/colloid</A> - Lennard-Jones wall interacting with finite-size particles
<LI><A HREF = "fix_wall_gran.html">wall/gran</A> - frictional wall(s) for granular simulations
<LI><A HREF = "fix_wall.html">wall/harmonic</A> - harmonic spring wall
<LI><A HREF = "fix_wall.html">wall/lj126</A> - Lennard-Jones 12-6 wall
<LI><A HREF = "fix_wall.html">wall/lj93</A> - Lennard-Jones 9-3 wall
<LI><A HREF = "fix_wall_piston.html">wall/piston</A> - moving reflective piston wall
<LI><A HREF = "fix_wall_reflect.html">wall/reflect</A> - reflecting wall(s)
<LI><A HREF = "fix_wall_region.html">wall/region</A> - use region surface as wall
<LI><A HREF = "fix_wall_srd.html">wall/srd</A> - slip/no-slip wall for SRD particles 
</UL>
<P>There are also additional fix styles submitted by users which are
included in the LAMMPS distribution.  The list of these with links to
the individual styles are given in the fix section of <A HREF = "Section_commands.html#cmd_5">this
page</A>.
</P>
<P>There are also additional accelerated fix styles included in the
LAMMPS distribution for faster performance on CPUs and GPUs.  The list
of these with links to the individual styles are given in the pair
section of <A HREF = "Section_commands.html#cmd_5">this page</A>.
</P>
<P><B>Restrictions:</B>
</P>
<P>Some fix styles are part of specific packages.  They are only enabled
if LAMMPS was built with that package.  See the <A HREF = "Section_start.html#start_3">Making
LAMMPS</A> section for more info on packages.
The doc pages for individual fixes tell if it is part of a package.
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "unfix.html">unfix</A>, <A HREF = "fix_modify.html">fix_modify</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>
